﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Microsoft.Reputation.Tests.FrontEndCommon
{
    public class TestStatusCodes
    {
        Dictionary<string, uint> data = new Dictionary<string, uint>();
        public TestStatusCodes()
        {
            data.Add("OK", 0x00000000); // everything OK
            data.Add("MoreData", 0x00000001); // there are more pages to fetch in listing API
            data.Add("NoMatch", 0x00001002); // given entry has no match
            data.Add("NoUpdate", 0x00001004); // means object was there, but with earlier stamp
            data.Add("RefreshAll", 0x00001008); // means listing detected deletion and returning all
            data.Add("Error", 0x80000000); // internal error (SQL connection/timeout, out-of-memory, and etc)
            //
            // Client ID Token validation
            //
            data.Add("TooManyRequests", 0x80000001); // Number of requests exceeds maximum value in web.config
            data.Add("NullClientIdToken", 0x80000002); // Client ID Token is null
            data.Add("NullCustomerGuid", 0x80000003); // Customer Guid is null
            data.Add("NullDeploymentGuid", 0x80000004); // Deployment Guid is null
            data.Add("NullClientGuid", 0x80000005); // Client Guid is null
            data.Add("NullCustomerVersion", 0x80000006); // Customer version is null or empty
            //
            // Lookup API validation
            //
            data.Add("NullLookupRequest", 0x80000010); // Lookup Request is null or empty
            data.Add("NullObjectGuid", 0x80000011); // LookupRequest Guid has no value and there are no SearchableFields
            data.Add("NullSearchableMetadata", 0x80000013); // Null searchable field
            data.Add("DuplicateSearchableMetadata", 0x80000014); // More than one searchable field with same name
            data.Add("InvalidSearchableMetadataEncode", 0x80000016); // SearchableFields Metadata is not properly encoded
            //
            // Filter validation
            //
            data.Add("DuplicateRequestedDataType", 0x80000030); // Same Data Type requested more than once in filter
            data.Add("ZeroRequestedMetadata", 0x80000031); // Requested Metadata count is zero
            data.Add("MetadataNotRequested", 0x80000032); // Requested metadata provided, but Metadata Type not requested
            data.Add("ZeroRequestedCategory", 0x80000033); // Requested Category count is zero
            data.Add("ReputationNotRequested", 0x80000034); // Requested Category provided, but Reputation Type not requeste
            //
            // Overrides validation
            //
            data.Add("InvalidOverrideStamp", 0x80000040); // Client override stamp is less than zero
            //
            // Object Type Specific validation
            //
            data.Add("InvalidObjectType", 0x80001001); // Invalidate/none supported object type
            data.Add("InvalidDataType", 0x80001002); // Invalidate requested data type in filter
            data.Add("InvalidMetadataType", 0x80001003); // Invalidate requested metadata type in filter
            data.Add("InvalidTypeForDataBlock", 0x80001004); // The DataBlock passed could not be cast to Byte[]
            data.Add("InvalidSearchableMetadata", 0x80001005); // Invalid Searchable Metadata
            data.Add("InvalidSearchableMetadataName", 0x80001006); // Invalidate searchable metadata name
            data.Add("InconsistentObjectType", 0x80001007); // Object types in requests are not consistent
        }

        public uint GetStatusCode(string str)
        {
            return data[str];
        }
    }
}
